package com.kang.controller;

import com.alibaba.fastjson.JSON;
import com.kang.model.Student;
import com.kang.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Administrator on 2018/1/2.
 */
@Controller
public class StudentController {

    @Autowired
    private StudentService service;

    @RequestMapping("/stdList")
    public String index() {
        return "/admin/student/studentList";
    }

    @RequestMapping("/loadStd")
    @ResponseBody
    public Object loadStd() {
        List<Student> list = service.getStudentList();
      /*  String userStr = "";
        if(CollectionUtils.isNotEmpty(list) && list.size()>0)
        {
            userStr = JSON.toJSONString(list);
        }*/

        return JSON.toJSON(list);
    }
}
